package com.onesports.intelligent.k12.polarlight.mapper.student;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.onesports.intelligent.k12.polarlight.annotation.DataPermission;
import com.onesports.intelligent.k12.polarlight.domain.dto.student.StudentManageDTO;
import com.onesports.intelligent.k12.polarlight.domain.entity.student.Student;
import com.onesports.intelligent.k12.polarlight.domain.vo.course.WeChatUserVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.student.StudentManageVO;
import com.onesports.intelligent.k12.polarlight.enums.DataPermissionTypeEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 学员表
 *
 * @author
 * @since 1.0.0 2022-07-08
 */
@Mapper
public interface StudentMapper extends BaseMapper<Student> {

    /**
     * class_student.active=true and class_info.class_status='3'才会查询的到
     * @param page
     * @param dto
     * @param orgId
     * @return
     */
    @DataPermission(tableName = "organization_campus",alias = "oc",value = DataPermissionTypeEnum.BY_CAMPUS)
    IPage<StudentManageVO> getPage(Page<StudentManageVO> page,
                                   @Param("dto") StudentManageDTO dto,
                                   @Param("orgId") String orgId);

    /**
     * 查找学生信息
     *
     * @param classInfoId 班级Id
     * @return {@link List}<{@link WeChatUserVO}>
     */
    List<WeChatUserVO> findStudent(@Param("classInfoId")String classInfoId);

    /**
     * 查找学生信息
     * @return
     */
    List<WeChatUserVO> findAllStudent();

    /**
     * 根据课程id查找家长的Userid集合
     * @param courseId kechengid
     * @return 家长id集合
     */
    List<String> getUserIds(@Param("courseId") String courseId);
}
